package yunwo.cn.yzstation.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

import yunwo.cn.yzstation.R;
import yunwo.cn.yzstation.bean.PopupBean;

/**
 * Created by linchubin on 2017/3/22.
 */

public class PopupConAdapter extends BaseAdapter {
    private List<PopupBean.DataBean> list;
    private Context context;
    private String type;

    public PopupConAdapter(List<PopupBean.DataBean> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (null == convertView) {
            holder = new ViewHolder();
            convertView = View.inflate(context, R.layout.adapter_popup_list, null);
            holder.nameTV = (TextView) convertView.findViewById(R.id.nameTV);
            convertView.setTag(holder);
            AutoUtils.autoSize(convertView);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.nameTV.setText(list.get(position).getName()+"  "+list.get(position).getPhone());
        return convertView;
    }

    class ViewHolder {
        TextView nameTV;
    }
}
